﻿CREATE PROCEDURE [dbo].[UpdateLog]
	@ID BIGINT,
	@LogType NVARCHAR(250),
	@Metadata XML
AS
BEGIN
	BEGIN TRY
		SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
		SET NOCOUNT ON;
		UPDATE [Reporting].[vwLogInfo]
		SET LogType = @LogType, Metadata = @Metadata, VersionUser = SYSTEM_USER, VersionDate = GETDATE()
		WHERE LogID = @ID
		RETURN 0
	END TRY
	BEGIN CATCH
		DECLARE @ErrorMessage NVARCHAR(4000);
		DECLARE @ErrorSeverity INT;
		DECLARE @ErrorState INT;

		SELECT	@ErrorMessage  = ERROR_MESSAGE(),
				@ErrorSeverity = ERROR_SEVERITY(),
				@ErrorState    = ERROR_STATE();

		RAISERROR(	@ErrorMessage,
					@ErrorSeverity,
					@ErrorState);
	END CATCH
END